class Transaction {
  final String id;
  final String orderNo;
  final int amount;
  final String status;
  final DateTime createTime;
  final String type;
  final String? memberLevelId;

  Transaction({
    required this.id,
    required this.orderNo,
    required this.amount,
    required this.status,
    required this.createTime,
    required this.type,
    this.memberLevelId,
  });

  factory Transaction.fromJson(Map<String, dynamic> json) => Transaction(
    id: json['id'] as String,
    orderNo: json['orderNo'] as String,
    amount: json['amount'] as int,
    status: json['status'] as String,
    createTime: DateTime.parse(json['createTime'] as String),
    type: json['type'] as String,
    memberLevelId: json['memberLevelId'] as String?,
  );

  Map<String, dynamic> toJson() => {
    'id': id,
    'orderNo': orderNo,
    'amount': amount,
    'status': status,
    'createTime': createTime.toIso8601String(),
    'type': type,
    'memberLevelId': memberLevelId,
  };
}